package com.example.demo.service;

import com.example.demo.vo.ConditionMonitoringDiagram;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * Created by 落羽 on 2017/8/23.
 * 状态监测图表数据服务
 */
@Service
public class ConditionMonitoringDiagramService {
    public ConditionMonitoringDiagram conditionMonitoringDiagram(ConditionMonitoringDiagram conditionMonitoringDiagram) {
        ArrayList dztx = new ArrayList();
        ArrayList dgx = new ArrayList();
        ArrayList dgy = new ArrayList();
        ArrayList dgv = new ArrayList();
        // 模拟数据
        for (int i = 0; i < 240; i++){
            dgx.add(20 + (int)(40 * Math.random()));
            dgy.add(20 + (int)(40 * Math.random()));
            dgv.add(10 + (int)(30 * Math.random()));
        }

        for (int i = 0; i < 20; i++){
            ArrayList dzt = new ArrayList();
            for (int j = 0; j < 240; j++){
                dzt.add(60 + (int)(5 * Math.random()) + (int)(10 * Math.random()));
            }
            dztx.add(dzt);
        }

        conditionMonitoringDiagram.getVibration().setDgX(dgx);
        conditionMonitoringDiagram.getVibration().setDgY(dgy);
        conditionMonitoringDiagram.getVibration().setDgV(dgv);
        conditionMonitoringDiagram.getTemperature().setDztx(dztx);

        return conditionMonitoringDiagram;
    }
}
